# -*- coding: UTF-8 -*-

from __future__ import absolute_import, division, print_function, unicode_literals

import datetime  # For datetime objects
import os.path  # To manage paths
import sys  # To find out the script name (in argv[0])

# Import the backtrader platform
import backtrader as bt

import MySQLDataFeed as mdf
import SimpleMySqlClass as smc
import talib as talib
import numpy as np
import akshare as ak
import pandas as pd
import json


"""
名称	类型	描述
indicator	str	indicator="今日"; choice of {"今日", "5日", "10日"}
sector_type	str	sector_type="行业资金流"; choice of {"行业资金流", "概念资金流", "地域资金流"}
"""


# 获取板块
def get_stock_sector_fund_flow_rank():
    stock_sector_fund_flow_rank_df = ak.stock_sector_fund_flow_rank(
        indicator="今日", sector_type="行业资金流"
    )
    print(stock_sector_fund_flow_rank_df)


# symbol="全部股票"；choice of {"全部股票", "沪深A股", "沪市A股", "科创板", "深市A股", "创业板", "沪市B股", "深市B股"}
def get_stock_main_fund_flow():
    stock_main_fund_flow_df = ak.stock_main_fund_flow(symbol="沪深A股")
    print(stock_main_fund_flow_df)


def get_stock_sector_fund_flow_summary_df():
    stock_sector_fund_flow_summary_df = ak.stock_sector_fund_flow_summary(
        symbol="电源设备", indicator="今日"
    )
    print(stock_sector_fund_flow_summary_df)


def get_stock_sector_fund_flow_hist_df():
    stock_sector_fund_flow_hist_df = ak.stock_sector_fund_flow_hist(symbol="汽车服务")
    print(stock_sector_fund_flow_hist_df)


def get_stock_info_sz_name_code_df():
    stock_info_sz_name_code_df = ak.stock_info_sz_name_code(symbol="A股列表")
    print(stock_info_sz_name_code_df)


def get_stock_board_concept_name_em_df():
    stock_board_concept_name_em_df = ak.stock_board_concept_name_em()
    print(stock_board_concept_name_em_df)


def get_stock_board_concept_spot_em_df():
    stock_board_concept_spot_em_df = ak.stock_board_concept_spot_em(symbol="可燃冰")
    print(stock_board_concept_spot_em_df)


if __name__ == "__main__":
    # 调用示例
    # get_stock_sector_fund_flow_rank()
    # get_stock_main_fund_flow()
    # get_stock_sector_fund_flow_summary_df()
    # get_stock_sector_fund_flow_hist_df()
    # get_stock_info_sz_name_code_df()
    # get_stock_board_concept_name_em_df()
    get_stock_board_concept_spot_em_df()
